package com.android.nearshop.app.activity.shop;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.ListView;
import android.widget.TextView;

import com.android.nearshop.R;
import com.android.nearshop.app.activity.common.TemplateActivity;
import com.android.nearshop.app.adapter.listadapter.CommontListAdapter;
import com.android.nearshop.app.widget.TitleBar;
import com.android.nearshop.app.widget.TitleBar.OnTitleClickListener;
import com.android.nearshop.io.protocol.in.CommentListAction;
import com.android.nearshop.util.Constant;


/**
 * 评论界面
 * @author huangyue
 *
 */
public class CommontActivity extends TemplateActivity {
	private ListView mList;
	private CommontListAdapter mCommontListAdapter;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		Intent intent = getIntent();
		int shopId = intent.getIntExtra(Constant.TAG_DETAIL_SHOPID, -1);
		
		setContentView(R.layout.activity_shop_commont);
		
		mList = (ListView) findViewById(R.id.listView);
		
		mCommontListAdapter = new CommontListAdapter(this, mList);
		mCommontListAdapter.setIdisplayNetErrAndRefreshView(this);
		mCommontListAdapter.setType(CommontListAdapter.COMMENT_TYPE);
		CommentListAction action = new CommentListAction(shopId, 1, 20);
		mList.setAdapter(mCommontListAdapter);
		
		mCommontListAdapter.setAction(action);					
		mCommontListAdapter.loadData();
	}
	
	protected void setupTitleBar(TitleBar titleBar) {
		titleBar.setLeftImage(0);
		titleBar.setRightVisible(false);
		titleBar.setTitle(R.string.commont_title);
		
		titleBar.setOnTitleClickListener(new OnTitleClickListener() {
			
			public void onRightClick() {
			}
			
			public void onLeftClick() {
				finish();
			}
		}, true, false);
	}
}
